package com.easygoods.request;

import com.bestvike.stone.spring.exception.AssertUtils;
import com.bestvike.stone.spring.rest.IRequest;
import com.easygoods.enums.Channel;
import lombok.Data;

/**
 * Created by 许崇雷 on 2018-12-26.
 */
@Data
public class SendRegisterSmsRequest implements IRequest {
    private Channel channel;
    private String openId;
    private String mobile;

    @SuppressWarnings("Duplicates")
    @Override
    public void assertValid() {
        AssertUtils.notNull(this.channel, "channel");
        AssertUtils.hasText(this.openId, "openid");
        AssertUtils.hasText(this.mobile, "mobile");
        AssertUtils.isTrue(this.mobile.length() == 11, "手机号格式错误");
    }
}
